package com.example.qianjun.robotbetago;

import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

/**
 * Created by qianjun on 2016/5/23.
 */
public class GlobalUtil {

    public static int width =0;
    public static int height = 0;
    public static int TEXT_SIZE = 18;

    public static void getTextSize(Activity activity){
        WindowManager windowManager = activity.getWindowManager();
        width = windowManager.getDefaultDisplay().getWidth();
        height = windowManager.getDefaultDisplay().getHeight();

        float ratioWidth = (float)width / 480;
        float ratioHeight = (float)height / 800;
        float RATIO = Math.min(ratioWidth, ratioHeight);


        //3.根据上一步计算出来的最小纵横比来确定字体的大小(假定在480*800屏幕下字体大小设定为35)

        TEXT_SIZE = Math.round(20 * RATIO);


    }

}
